package com.changgou.listener;

import com.changgou.config.RabbitMQConfig;
import com.changgou.service.SkuSearchService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class GoodsDelListener {

    @Autowired
    private SkuSearchService skuSearchService;


    @RabbitListener(queues = RabbitMQConfig.SEARCH_DEL_QUEUE)
    public void searchDelete(String spuId){
        System.out.println("接收到的消息是:"+spuId);
        try {
            skuSearchService.delBySpuId(spuId);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
